<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>http://www.blueb.co.kr</title>
<style type="text/css">
    span {position:absolute; left:-1000; overflow:hidden;}
    img  {position:absolute;}
</style>
<script type="text/javascript">
<!--
window.onerror         = new Function("return true")
document.onselectstart = new Function("return false")
screen.bufferDepth     = 16

nx  = 0
ny  = 0
xm  = 0
ym  = -10000
S   = 0
O   = 0
M   = 10
var H
var W
var img

/////////////
RAD  = 2
Nx   = 12
Ny   = 14
visc = .01
/////////////

function CObj(parent,x,y){
    o = document.createElement("span")
    o.style.width = W + 2
    o.style.height = H + 2
    i = document.createElement("img")
    i.src = img.src
    i.style.left = -x * W
    i.style.top = -y * H
    o.appendChild(i)
    document.getElementById("SP").appendChild(o)
    x = -(Nx / 2) * W + (x * W)
    y = -(Ny / 2) * H + (y * H)
    this.obj  = o.style
    this.x   = x
    this.y   = y
    this.x0  = x
    this.y0  = y
    this.anim = function () {
        with(this){
            dx = xm - x
            dy = ym - y
            d = Math.sqrt(dx * dx + dy * dy)
            obj.left = x = x - S / d * (dx / d) + (x0 - x) * visc
            obj.top  = y = y - S / d * (dy / d) + (y0 - y) * visc
            if(parent)parent.anim()
        }
    }
}

function run(){
    O.anim()
    setTimeout("run()", 16)
}

document.onmousemove = function(e){
    if(M>0)M--;
    else {
        if (window.event) e = window.event
        xm = (e.x || e.clientX) - nx
        ym = (e.y || e.clientY) - ny
    }
}

function resize(){
    nx = document.body.offsetWidth * .5
    ny = document.body.offsetHeight * .5
}
onresize = resize

onload = function(){
    resize()
    img = document.getElementById("IMG")
    W = img.width / Nx
    H = img.height / Ny
    S = img.width * RAD
    for(y=0;y<Ny;y++) for(x=0;x<Nx;x++) O = new CObj(O, x, y)
    run()
}
//-->
</script>
</head>
<body>

<div id=SP style="position:absolute;left:50%;top:50%"></div>

<img id=IMG src="http://www.blueb.co.kr/SRC/javascript/image3/nm12a.jpg" style="visibility:hidden">

</body>
</html>